* Replication for: The shifting class-base of social democratic parties in Western Europe, in European Politics and Society 2021, DOI: 10.1080/23745118.2021.1909806
* Authors: Achim Hildebrandt/Sebastian Jäckle
* Dataset "Shifting Class Base" based on European Social Survey Cumulative File, ESS 1-8 & European Social Survey Round 9 Data
* Running the complete Do-File takes about 40 minutes
	version 15	
	clear all
	set matsize 11000
	set more off 
	
* Timer on
timer on 1	


* set working directory	
cd "YOURPATH\Replication data"

* Open "Shifting Class Base.dta"
use "data\Shifting Class Base.dta"		

* Main text
* Fig 1: 	line 43
* Fig 2: 	line 103
* Fig 3: 	line 473

* Online Appendix
* Tab A2: 	line 895
* Fig A1:	line 907
* Fig A2:   line 997
* Fig A3:   line 1158
* Fig A4:   line 1478
* Tab A3:	line 1509 
* Fig A5:	line 1516
* Fig A6:	line 1922

***********************************************************************************************************
***********************************************************************************************************
***											Main Article    											***
***********************************************************************************************************											
***********************************************************************************************************	


***********************************************************************************************************
**** 				Fig 1: Cultural and economic policy preferences by class (+99% CI)					***
***********************************************************************************************************

*** Check correlations between class and the two controls education and size of community
* crosstab education x class & wohnort x class --> Cramers V
tab education class, V
tab wohnort class, V


****		Regressionsplots AV die vier Attitude-Variablen (UV: Class mit Clerks als Referenz + controls)
	set scheme plottigblind
	
	* Model 2a)
	reg eink01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Redistribution

	* Model 2b)								
	reg gay01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear) 
		est store Gay_rights
		
	* Model 2c)
	reg eu01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education												 									///
		ib13.country		, cl(cyear)
		est store EU
		
	* Model 2d)					
	reg immigr 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Immigration

		*coefplot nur mit 99% CI
		coefplot Redistribution || Immigration || Gay_rights, bylabel(Gay Rights)  || EU , 	keep(*.class)		///
														drop(_cons) levels( 99 ) legend(order( 1 "99" ) row(1))														///
														xline(0) 															
		graph save "dump\coefplot_attitudes_99ci", replace
		graph use "dump\coefplot_attitudes_99ci.gph"
		graph export "output\figures\Fig_1.pdf", replace 
	

	
	
***********************************************************************************************************
**** Fig 2: Effects of class on voting for social democrats by type of social democratic party (+95% CI)***
***********************************************************************************************************

	* 2 - CH
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 2																///
							, cl(cyear) b(0) 
	est store model_3a_CH
	esttab model_3a_CH using "output\tables\model_3a_CH.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_CH: margins, dydx(class) post
	esttab model_3a_me_CH using "output\tables\model_3a_me_CH.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace							
								
	
	
	
	* 3 - DE
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 3																///
							, cl(cyear) b(0) 
	est store model_3a_DE
	esttab model_3a_DE using "output\tables\model_3a_DE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_DE: margins, dydx(class) post
	esttab model_3a_me_DE using "output\tables\model_3a_me_DE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
								
	* 4 - DK
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 4																///
							, cl(cyear) b(0) 
	est store model_3a_DK
	esttab model_3a_DK using "output\tables\model_3a_DK.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_DK: margins, dydx(class) post
	esttab model_3a_me_DK using "output\tables\model_3a_me_DK.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 5 - ES
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 5																///
							, cl(cyear) b(0) 
	est store model_3a_ES
	esttab model_3a_ES using "output\tables\model_3a_ES.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_ES: margins, dydx(class) post
	esttab model_3a_me_ES using "output\tables\model_3a_me_ES.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 6 - FI
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 6																///
							, cl(cyear) b(0) 
	est store model_3a_FI
	esttab model_3a_FI using "output\tables\model_3a_FI.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_FI: margins, dydx(class) post
	esttab model_3a_me_FI using "output\tables\model_3a_me_FI.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 7 - FR
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 7																///
							, cl(cyear) b(0) 
	est store model_3a_FR
	esttab model_3a_FR using "output\tables\model_3a_FR.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_FR: margins, dydx(class) post
	esttab model_3a_me_FR using "output\tables\model_3a_me_FR.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 8 - GB
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 8																///
							, cl(cyear) b(0) 
	est store model_3a_GB
	esttab model_3a_GB using "output\tables\model_3a_GB.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_GB: margins, dydx(class) post
	esttab model_3a_me_GB using "output\tables\model_3a_me_GB.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 9 - IE
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 9																///
							, cl(cyear) b(0) 
	est store model_3a_IE
	esttab model_3a_IE using "output\tables\model_3a_IE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_IE: margins, dydx(class) post
	esttab model_3a_me_IE using "output\tables\model_3a_me_IE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
	
	* 10 - NL
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 10																///
							, cl(cyear) b(0) 
	est store model_3a_NL
	esttab model_3a_NL using "output\tables\model_3a_NL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_NL: margins, dydx(class) post
	esttab model_3a_me_NL using "output\tables\model_3a_me_NL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
/* Does not converge!
	* 11 - NO
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 11																///
							, cl(cyear) b(0) 
	est store model_3a_NO
	esttab model_3a_NO using model_3a_NO.rtf, 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	 */														
						
/*
	eststo model_3a_me_NO: margins, dydx(class) post
	esttab model_3a_me_NO using model_3a_me_NO.rtf, stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace */		
		
		* 11 - NO1 --> greens = others
	 mlogit  wahlabsicht_5_NO1 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 11																///
							, cl(cyear) b(0) 
	est store model_3a_NO1
	esttab model_3a_NO1 using "output\tables\model_3a_NO1.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_NO1: margins, dydx(class) post
	esttab model_3a_me_NO1 using "output\tables\model_3a_me_NO1.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	
											
	* 12 - PT --> if there are o standard errors in the output --> run again! (= bug in Stata!)
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 12 																///
							, cl(cyear) b(0) 
	est store model_3a_PT
	esttab model_3a_PT using "output\tables\model_3a_PT.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_PT: margins, dydx(class) post
	esttab model_3a_me_PT using "output\tables\model_3a_me_PT.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
	* 13 - SE
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 13																///
							, cl(cyear) b(0) 
	est store model_3a_SE
	esttab model_3a_SE using "output\tables\model_3a_SE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_SE: margins, dydx(class) post
	esttab model_3a_me_SE using "output\tables\model_3a_me_SE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
	* Flandres
	mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if flemish_new == 1															///
							, cl(cyear) b(0) 
	est store model_3a_FL
	esttab model_3a_FL using "output\tables\model_3a_FL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_FL: margins, dydx(class) post
	esttab model_3a_me_FL using "output\tables\model_3a_me_FL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	

	
	* Walloon
	mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if walloon_new == 1															///
							, cl(cyear) b(0) 
	est store model_3a_WAL
	esttab model_3a_WAL using "output\tables\model_3a_WAL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3a_me_WAL: margins, dydx(class) post
	esttab model_3a_me_WAL using "output\tables\model_3a_me_WAL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	

** Coefplots based on the country models - by type of class base 
* take care that the parties selected by "keep" are actually Social Democrats (in countries in which not every party family is present the fourth _predict is not the social democrats)
* 1) Traditional SD 	(Denmark, Spain, Sweden)
* 2) Modern SD			(Netherlands, UK)
* 3) Postmodern SD		(France, Switzerland)
* 4) Others				(Flemish region, Walloon region, Germany, Ireland, Norway, Portugal)

set scheme plotplain
* 	1) Traditional SD 	(Denmark, , Finland, Netherlands, Spain, Sweden)
	coefplot    (model_3a_me_DK , keep(*:3._predict) label(Denmark))   		///
				(model_3a_me_FI , keep(*:4._predict) label(Finland)) 		///
				(model_3a_me_NL , keep(*:4._predict) label(Netherlands)) 	///
				(model_3a_me_ES , keep(*:3._predict) label(Spain))   		///
				(model_3a_me_SE , keep(*:4._predict) label(Sweden))   		///
	 , swapnames title("traditional")  xline(0) xsize(6) ysize(3) xsc(r(-.3 .2)) xlabel(-.3(.1).2)
		graph save "dump\Fig_2_part3.gph", replace
		
* 	2) Modern SD 	(UK)
	coefplot    (model_3a_me_GB , keep(*:3._predict) label(`" "United" "Kingdom" "'))   ///
               , swapnames title("modern") xline(0) xsize(6) ysize(1) xsc(r(-.3 .2)) xlabel(-.3(.1).2)  legend(row(1)) fysize(20) fxsize(95)
		graph save "dump\Fig_2_part1.gph", replace
		
*	3) Postmodern SD (France, Switzerland)
		coefplot    (model_3a_me_FR , keep(*:4._predict) label(France))   ///
					(model_3a_me_CH , keep(*:3._predict) label(Switzerland))   ///
               , swapnames title("postmodern") xline(0) xsize(6)  ysize(2) xsc(r(-.3 .2)) xlabel(-.3(.1).2) fysize(40)
		graph save "dump\Fig_2_part2.gph", replace
	
	graph combine "dump\Fig_2_part1.gph" "dump\Fig_2_part2.gph" "dump\Fig_2_part3.gph", col(1) iscale(.5) ysize(9) graphregion(margin(zero)) ycommon
	graph export "output\figures\Fig_2_grey.pdf", replace

set scheme plottigblind
* 	1) Traditional SD 	(Denmark, , Finland, Netherlands, Spain, Sweden)
	coefplot    (model_3a_me_DK , keep(*:3._predict) label(Denmark))   		///
				(model_3a_me_FI , keep(*:4._predict) label(Finland)) 		///
				(model_3a_me_NL , keep(*:4._predict) label(Netherlands)) 	///
				(model_3a_me_ES , keep(*:3._predict) label(Spain))   		///
				(model_3a_me_SE , keep(*:4._predict) label(Sweden))   		///
	 , swapnames title("traditional")  xline(0) xsize(6) ysize(3) xsc(r(-.3 .2)) xlabel(-.3(.1).2)
		graph save "dump\Fig_2_part3.gph", replace
		
* 	2) Modern SD 	(UK)
	coefplot    (model_3a_me_GB , keep(*:3._predict) label(`" "United" "Kingdom" "'))   ///
               , swapnames title("modern") xline(0) xsize(6) ysize(1) xsc(r(-.3 .2)) xlabel(-.3(.1).2)  legend(row(1)) fysize(20) fxsize(95)
		graph save "dump\Fig_2_part1.gph", replace
		
*	3) Postmodern SD (France, Switzerland)
		coefplot    (model_3a_me_FR , keep(*:4._predict) label(France))   ///
					(model_3a_me_CH , keep(*:3._predict) label(Switzerland))   ///
               , swapnames title("postmodern") xline(0) xsize(6)  ysize(2) xsc(r(-.3 .2)) xlabel(-.3(.1).2) fysize(40)
		graph save "dump\Fig_2_part2.gph", replace
	
	graph combine "dump\Fig_2_part1.gph" "dump\Fig_2_part2.gph" "dump\Fig_2_part3.gph", col(1) iscale(.5) ysize(9) graphregion(margin(zero)) ycommon
	graph export "output\figures\Fig_2_color.pdf", replace	
		

		
		
		
***********************************************************************************************************
**** 			Fig 3: Effects of class on voting for social democrats by ESS round (+95% CI) 			***
***********************************************************************************************************

* Logit-Models for ESS-Round 1-4 und 5-9 logit
	
	
* 2 - CH
	set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 2	& essround_2 == `i'											 
								
							
	est store model_4a_CH_`i'
	esttab model_4a_CH_`i' using "output\tables\model_4a_CH`i'.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_CH_`i': margins, dydx(class) post
	esttab model_4a_me_CH_`i' using "output\tables\model_4a_me_CH_`i'.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_CH_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_CH_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)   title("Switzerland - postmodern") yscale(off) legend(rows(1))
		graph save "dump\me_logit_CH_2.gph", replace
	

* 3 - DE
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 3	& essround_2 == `i'											 
								
							
	est store model_4a_DE_`i'
	esttab model_4a_DE_`i' using "output\tables\model_4a_DE`i'.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_DE_`i': margins, dydx(class) post
	esttab model_4a_me_DE_`i' using "output\tables\model_4a_me_DE_`i'.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_DE_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_DE_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)   title("Germany") legend(rows(1))
		graph save "dump\me_logit_DE_2.gph", replace
	
		
* 4 - DK
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 4	& essround_2 == `i'											 
								
							
	est store model_4a_DK_`i'
	esttab model_4a_DK_`i' using "output\tables\model_4a_DK`i'.rtf", 	stats(r2_p DKi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_DK_`i': margins, dydx(class) post
	esttab model_4a_me_DK_`i' using "output\tables\model_4a_me_DK_`i'.rtf", stats(r2_p DKi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_DK_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_DK_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95 )  xline(0)  title("Denmark - traditional") yscale(off) legend(rows(1))
		graph save "dump\me_logit_DK_2.gph", replace
			
		
* 5 - ES
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 5	& essround_2 == `i'											 
								
							
	est store model_4a_ES_`i'
	esttab model_4a_ES_`i' using "output\tables\model_4a_ES`i'.rtf", 	stats(r2_p ESi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_ES_`i': margins, dydx(class) post
	esttab model_4a_me_ES_`i' using "output\tables\model_4a_me_ES_`i'.rtf", stats(r2_p ESi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_ES_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_ES_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Spain - traditional")  legend(rows(1))
		graph save "dump\me_logit_ES_2.gph", replace
			
		
* 6 - FI
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 6	& essround_2 == `i'											 
								
							
	est store model_4a_FI_`i'
	esttab model_4a_FI_`i' using "output\tables\model_4a_FI`i'.rtf", 	stats(r2_p FIi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_FI_`i': margins, dydx(class) post
	esttab model_4a_me_FI_`i' using "output\tables\model_4a_me_FI_`i'.rtf", stats(r2_p FIi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_FI_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_FI_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Finland - traditional")  yscale(off) legend(rows(1))
		graph save "dump\me_logit_FI_2.gph", replace
			
		
		
* 7 - FR
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 7	& essround_2 == `i'											 
								
							
	est store model_4a_FR_`i'
	esttab model_4a_FR_`i' using "output\tables\model_4a_FR`i'.rtf", 	stats(r2_p FRi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_FR_`i': margins, dydx(class) post
	esttab model_4a_me_FR_`i' using "output\tables\model_4a_me_FR_`i'.rtf", stats(r2_p FRi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_FR_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_FR_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("France - postmodern") legend(rows(1))
		graph save "dump\me_logit_FR_2.gph", replace
			
		
* 8 - GB
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 8	& essround_2 == `i'											 
								
							
	est store model_4a_GB_`i'
	esttab model_4a_GB_`i' using "output\tables\model_4a_GB`i'.rtf", 	stats(r2_p GBi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_GB_`i': margins, dydx(class) post
	esttab model_4a_me_GB_`i' using "output\tables\model_4a_me_GB_`i'.rtf", stats(r2_p GBi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_GB_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_GB_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("United Kingdom - modern") legend(rows(1))
		graph save "dump\me_logit_GB_2.gph", replace
			
		
* 9 - IE
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 9	& essround_2 == `i'											 
								
							
	est store model_4a_IE_`i'
	esttab model_4a_IE_`i' using "output\tables\model_4a_IE`i'.rtf", 	stats(r2_p IEi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_IE_`i': margins, dydx(class) post
	esttab model_4a_me_IE_`i' using "output\tables\model_4a_me_IE_`i'.rtf", stats(r2_p IEi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_IE_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_IE_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Ireland") legend(rows(1))
		graph save "dump\me_logit_IE_2.gph", replace
			
		
* 10 - NL
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 10	& essround_2 == `i'											 
								
							
	est store model_4a_NL_`i'
	esttab model_4a_NL_`i' using "output\tables\model_4a_NL`i'.rtf", 	stats(r2_p NLi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_NL_`i': margins, dydx(class) post
	esttab model_4a_me_NL_`i' using "output\tables\model_4a_me_NL_`i'.rtf", stats(r2_p NLi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_NL_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_NL_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Netherlands - traditional") legend(rows(1))
		graph save "dump\me_logit_NL_2.gph", replace
			
		
* 11 - NO
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 11	& essround_2 == `i'											 
								
							
	est store model_4a_NO_`i'
	esttab model_4a_NO_`i' using "output\tables\model_4a_NO`i'.rtf", 	stats(r2_p NOi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_NO_`i': margins, dydx(class) post
	esttab model_4a_me_NO_`i' using "output\tables\model_4a_me_NO_`i'.rtf", stats(r2_p NOi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_NO_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_NO_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Norway") legend(rows(1))
		graph save "dump\me_logit_NO_2.gph", replace
		

* 12 - PT
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 12	& essround_2 == `i'											 
								
							
	est store model_4a_PT_`i'
	esttab model_4a_PT_`i' using "output\tables\model_4a_PT`i'.rtf", 	stats(r2_p PTi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_PT_`i': margins, dydx(class) post
	esttab model_4a_me_PT_`i' using "output\tables\model_4a_me_PT_`i'.rtf", stats(r2_p PTi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_PT_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_PT_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Portugal") legend(rows(1))
		graph save "dump\me_logit_PT_2.gph", replace
			
		
* 13 - SE
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 13	& essround_2 == `i'											 
								
							
	est store model_4a_SE_`i'
	esttab model_4a_SE_`i' using "output\tables\model_4a_SE`i'.rtf", 	stats(r2_p SEi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_SE_`i': margins, dydx(class) post
	esttab model_4a_me_SE_`i' using "output\tables\model_4a_me_SE_`i'.rtf", stats(r2_p SEi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_SE_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_SE_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95 )  xline(0)  title("Sweden - traditional") yscale(off) legend(rows(1))
		graph save "dump\me_logit_SE_2.gph", replace
			
	
* 14 - FL
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if flemish_new  == 1	& essround_2 == `i'											 
								
							
	est store model_4a_FL_`i'
	esttab model_4a_FL_`i' using "output\tables\model_4a_FL`i'.rtf", 	stats(r2_p FLi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_FL_`i': margins, dydx(class) post
	esttab model_4a_me_FL_`i' using "output\tables\model_4a_me_FL_`i'.rtf", stats(r2_p FLi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_FL_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_FL_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Belgium - Flemish region") legend(rows(1))
		graph save "dump\me_logit_FL_2.gph", replace
		
	
* 15 - WL
set scheme plottigblind
	forvalues i = 1(1)2 {
	logit  wahlabsicht_sd 	ib1.class 																	///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if walloon_new == 1	& essround_2 == `i'											 
								
							
	est store model_4a_WL_`i'
	esttab model_4a_WL_`i' using "output\tables\model_4a_WL`i'.rtf", 	stats(r2_p WLi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_WL_`i': margins, dydx(class) post
	esttab model_4a_me_WL_`i' using "output\tables\model_4a_me_WL_`i'.rtf", stats(r2_p WLi2 N, labels("Pseudo R-squared" "Model Chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace				
	}			
		
		coefplot    (model_4a_me_WL_1 ,  label(ESS-Round 1-4) )   		///
					(model_4a_me_WL_2 ,  label(ESS Round >=5) ) 		///
	 ,   levels ( 95  )  xline(0)  title("Belgium - Walloon region") legend(rows(1))
		graph save "dump\me_logit_WL_2.gph", replace
				
						
	
set scheme plottigblind
grc1leg 		"dump\me_logit_GB_2.gph" ///
				"dump\me_logit_CH_2.gph" ///
				"dump\me_logit_FR_2.gph" ///
				"dump\me_logit_DK_2.gph" ///
				"dump\me_logit_ES_2.gph" ///
				"dump\me_logit_FI_2.gph" ///
				"dump\me_logit_NL_2.gph" ///
				"dump\me_logit_SE_2.gph" ///
				, rows(4) ycommon xcommon xsize(6) ysize(5) scale(.7)
	graph save "dump\me_logit_2_all.gph", replace
	graph use "dump\me_logit_2_all.gph"
	graph export "output\figures\Fig_3_color.pdf", replace  	
											
***********************************************************************************************************
***********************************************************************************************************
***												APPENDIX    											***
***********************************************************************************************************											
***********************************************************************************************************											


***********************************************************************************************************
**** 								Table A2: Descriptive statistics									***
***********************************************************************************************************

sum i.wahlabsicht_3 i.wahlabsicht_5 i.wahlabsicht_5_NO1 i.wahlabsicht_5_NO2 i.class eink01 immigr eu01 gay01 i.gndr agea i.wohnort i.education 
tab country
tab essround
tab class
tab wahlabsicht_5
tab education
tab wohnort

***********************************************************************************************************
**** 				Fig A1: Cultural and economic policy preferences by class (+99% CI)					***
****						with post-stratification weights											***
***********************************************************************************************************

****		Unweighted
	set scheme plottigblind
	* Model 2a)
	reg eink01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Redistribution_unweighted

	* Model 2b)								
	reg gay01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear) 
		est store Gay_rights_unweighted
		
	* Model 2c)
	reg eu01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education												 									///
		ib13.country		, cl(cyear)
		est store EU_unweighted
		
	* Model 2d)					
	reg immigr 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Immigration_unweighted

* With Poststratification Weights
	* Model 2a)
	reg eink01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country	[pweight=pspwght]	, cl(cyear)
		est store Redistribution_weighted

	* Model 2b)								
	reg gay01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country	[pweight=pspwght]	, cl(cyear)
		est store Gay_rights_weighted
		
	* Model 2c)
	reg eu01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education												 									///
		ib13.country	[pweight=pspwght]	, cl(cyear)
		est store EU_weighted
		
	* Model 2d)					
	reg immigr 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country	[pweight=pspwght]	, cl(cyear)
		est store Immigration_weighted

		*coefplot nur mit 99% CI
		coefplot   		Redistribution_unweighted Redistribution_weighted, bylabel(Redistribution) ///
					|| 	Immigration_unweighted Immigration_weighted  , bylabel(Immigration)     ///
					|| 	Gay_rights_unweighted Gay_rights_weighted     , bylabel(Gay Rights)    ///
					|| 	EU_unweighted EU_weighted , bylabel(EU) 	keep(*.class)		///
														drop(_cons) levels( 99 ) legend(order( 2 "unweighted" 4 "with poststratification weights" ) row(1))														///
														xline(0) 															
		graph export "output\figures\Fig_A1.pdf", replace 


***********************************************************************************************************
**** 				Fig A2: Cultural and economic policy preferences by class (+99% CI)					***
****						without domicile / education /  domicile & education						***
***********************************************************************************************************		

****		as in Fig 1
	set scheme plottigblind
	* Model 2a)
	reg eink01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Redistribution

	* Model 2b)								
	reg gay01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear) 
		est store Gay_rights
		
	* Model 2c)
	reg eu01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education												 									///
		ib13.country		, cl(cyear)
		est store EU
		
	* Model 2d)					
	reg immigr 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Immigration

		

* check: without wohnort 
		* Model 2a)
	reg eink01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Redistribution_1

	* Model 2b)								
	reg gay01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Gay_rights_1
		
	* Model 2c)
	reg eu01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																			///
		i.education												 									///
		ib13.country		, cl(cyear)
		est store EU_1
		
	* Model 2d)					
	reg immigr 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																			///
		i.education													 									///
		ib13.country		, cl(cyear)
		est store Immigration_1

	* check: without education
	* Model 2a)
	reg eink01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		ib13.country		, cl(cyear)
		est store Redistribution_2

	* Model 2b)								
	reg gay01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		ib13.country		, cl(cyear)
		est store Gay_rights_2
		
	* Model 2c)
	reg eu01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		ib13.country		, cl(cyear)
		est store EU_2
		
	* Model 2d)					
	reg immigr 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea ib0.wohnort																			///
		ib13.country		, cl(cyear)
		est store Immigration_2

	* check: without education and wohnort 
		
	* Model 2a)
	reg eink01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																						///
		ib13.country 		, cl(cyear)
		est store Redistribution_3

	* Model 2b)								
	reg gay01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																						///
		ib13.country		, cl(cyear)
		est store Gay_rights_3
		
	* Model 2c)
	reg eu01 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																						///
		ib13.country	 	, cl(cyear)
		est store EU_3
		
	* Model 2d)					
	reg immigr 																							///
		ib1.class 																						///
		ib1.essround 																					///
		gndr agea 																						///
		ib13.country		, cl(cyear)
		est store Immigration_3

		
		*coefplot nur mit 99% CI
		coefplot   		Redistribution Redistribution_1 Redistribution_2 Redistribution_3, bylabel(Redistribution) ///
					|| 	Immigration Immigration_1 Immigration_2 Immigration_3, bylabel(Immigration)     ///
					|| 	Gay_rights Gay_rights_1 Gay_rights_2 Gay_rights_3     , bylabel(Gay Rights)    ///
					|| 	EU EU_1 EU_2 EU_3 , bylabel(EU) 	keep(*.class)		///
														drop(_cons) levels( 99 ) legend(order( 2 "main models as in Fig 1" 4 "without controlling for domicile" 6 "without controlling for education" 8 "withouth controlling for domicile & education" ) row(2))														///
														xline(0)  aspectratio(1) msize(.5)														
		graph export "output\figures\Fig_A2.pdf", replace 
		

		
***********************************************************************************************************
**** Fig A3: Effects of class on voting for social democrats by type of social democratic party (+95% CI)***
****									without controlling for domicile & education					***
***********************************************************************************************************

	* 2 - CH
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 2																///
							, cl(cyear) b(0) 
	est store model_3b_CH
	esttab model_3b_CH using "output\tables\model_3b_CH.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_CH: margins, dydx(class) post
	esttab model_3b_me_CH using "output\tables\model_3b_me_CH.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace							
								
	
	
	
	* 3 - DE
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea 													///
							if country == 3																///
							, cl(cyear) b(0) 
	est store model_3b_DE
	esttab model_3b_DE using "output\tables\model_3b_DE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_DE: margins, dydx(class) post
	esttab model_3b_me_DE using "output\tables\model_3b_me_DE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
								
	* 4 - DK
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 4																///
							, cl(cyear) b(0) 
	est store model_3b_DK
	esttab model_3b_DK using "output\tables\model_3b_DK.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_DK: margins, dydx(class) post
	esttab model_3b_me_DK using "output\tables\model_3b_me_DK.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 5 - ES
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 5																///
							, cl(cyear) b(0) 
	est store model_3b_ES
	esttab model_3b_ES using "output\tables\model_3b_ES.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_ES: margins, dydx(class) post
	esttab model_3b_me_ES using "output\tables\model_3b_me_ES.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 6 - FI
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 6																///
							, cl(cyear) b(0) 
	est store model_3b_FI
	esttab model_3b_FI using "output\tables\model_3b_FI.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_FI: margins, dydx(class) post
	esttab model_3b_me_FI using "output\tables\model_3b_me_FI.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 7 - FR
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 7																///
							, cl(cyear) b(0) 
	est store model_3b_FR
	esttab model_3b_FR using "output\tables\model_3b_FR.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_FR: margins, dydx(class) post
	esttab model_3b_me_FR using "output\tables\model_3b_me_FR.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 8 - GB
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 8																///
							, cl(cyear) b(0) 
	est store model_3b_GB
	esttab model_3b_GB using "output\tables\model_3b_GB.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_GB: margins, dydx(class) post
	esttab model_3b_me_GB using "output\tables\model_3b_me_GB.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 9 - IE
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 9																///
							, cl(cyear) b(0) 
	est store model_3b_IE
	esttab model_3b_IE using "output\tables\model_3b_IE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_IE: margins, dydx(class) post
	esttab model_3b_me_IE using "output\tables\model_3b_me_IE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
	
	* 10 - NL
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 10															///
							, cl(cyear) b(0) 
	est store model_3b_NL
	esttab model_3b_NL using "output\tables\model_3b_NL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_NL: margins, dydx(class) post
	esttab model_3b_me_NL using "output\tables\model_3b_me_NL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	

		* 11 - NO1 --> greens = others
	 mlogit  wahlabsicht_5_NO1 	ib1.class 																	///
																											///
							ib1.essround																	///
							i.gndr c.agea 																	///
							if country == 11																///
							, cl(cyear) b(0) 
	est store model_3b_NO1
	esttab model_3b_NO1 using "output\tables\model_3b_NO1.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_NO1: margins, dydx(class) post
	esttab model_3b_me_NO1 using "output\tables\model_3b_me_NO1.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	
											
	
	* 12 - PT --> if there are o standard errors in the output --> run again! (= bug in Stata!)
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 12 															///
							, cl(cyear) b(0) 
	est store model_3b_PT
	esttab model_3b_PT using "output\tables\model_3b_PT.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_PT: margins, dydx(class) post
	esttab model_3b_me_PT using "output\tables\model_3b_me_PT.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
	* 13 - SE
	 mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if country == 13															///
							, cl(cyear) b(0) 
	est store model_3b_SE
	esttab model_3b_SE using "output\tables\model_3b_SE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_SE: margins, dydx(class) post
	esttab model_3b_me_SE using "output\tables\model_3b_me_SE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
	* Flandres
	mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if flemish_new == 1															///
							, cl(cyear) b(0) 
	est store model_3b_FL
	esttab model_3b_FL using "output\tables\model_3b_FL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_FL: margins, dydx(class) post
	esttab model_3b_me_FL using "output\tables\model_3b_me_FL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	

	
	* Walloon
	mlogit  wahlabsicht_5 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea 																///
							if walloon_new == 1															///
							, cl(cyear) b(0) 
	est store model_3b_WAL
	esttab model_3b_WAL using "output\tables\model_3b_WAL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_3b_me_WAL: margins, dydx(class) post
	esttab model_3b_me_WAL using "output\tables\model_3b_me_WAL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	

** Coefplots based on the country models - by type of class base 
* take care that the parties selected by "keep" are actually Social Democrats (in countries in which not every party family is present the fourth _predict is not the social democrats)
* 1) Traditional SD 	(Denmark, Spain, Sweden)
* 2) Modern SD			(Netherlands, UK)
* 3) Postmodern SD		(France, Switzerland)
* 4) Others				(Flemish region, Walloon region, Germany, Ireland, Norway, Portugal)


set scheme plottigblind
* 	1) Traditional SD 	(Denmark, , Finland, Netherlands, Spain, Sweden)
	coefplot    (model_3b_me_DK , keep(*:3._predict) label(Denmark))   		///
				(model_3b_me_FI , keep(*:4._predict) label(Finland)) 		///
				(model_3b_me_NL , keep(*:4._predict) label(Netherlands)) 	///
				(model_3b_me_PT , keep(*:3._predict) label(Portugal)) 	  	///
				(model_3b_me_ES , keep(*:3._predict) label(Spain))   		///
				(model_3b_me_SE , keep(*:4._predict) label(Sweden))   		///
				(model_3b_me_WAL , keep(*:4._predict) label(`" "Walloon" "Region" "')) ///
	 , swapnames title("traditional")  xline(0) xsize(6) ysize(3) xsc(r(-.4 .2)) xlabel(-.4(.1).2)
		graph save "dump\Fig_A3_part3.gph", replace
		
* 	2) Modern SD 	(UK)
	coefplot    (model_3b_me_GB , keep(*:3._predict) label(`" "United" "Kingdom" "'))   ///
               , swapnames title("modern") xline(0) xsize(6) ysize(1) xsc(r(-.4 .2)) xlabel(-.4(.1).2)  legend(row(1)) fysize(20) fxsize(95)
		graph save "dump\Fig_A3_part1.gph", replace
		
*	3) Postmodern SD (France, Switzerland)
		coefplot    (model_3b_me_FR , keep(*:4._predict) label(France))   ///
					(model_3b_me_CH , keep(*:3._predict) label(Switzerland))   ///
               , swapnames title("postmodern") xline(0) xsize(6)  ysize(2) xsc(r(-.4 .2)) xlabel(-.4(.1).2) fysize(40)
		graph save "dump\Fig_A3_part2.gph", replace
	
	graph combine "dump\Fig_A3_part1.gph" "dump\Fig_A3_part2.gph" "dump\Fig_A3_part3.gph", col(1) iscale(.5) ysize(9) graphregion(margin(zero)) ycommon
	graph export "output\figures\Fig_A3_color.pdf", replace	



		
		
		
		
		

***********************************************************************************************************
**** 				Fig A4: Effects of class on voting for social democratic parties 					***
****							– Classless social democratic parties (+ 95% CI)						***
***********************************************************************************************************
		
		* Main models
		*   4) Without a class base (Germany, Ireland, Norway, Portugal, Flanders, Walloon)
		set scheme plottigblind
		coefplot    (model_3a_me_FL , keep(*:4._predict) label(Flemish Region)) ///
					(model_3a_me_WAL , keep(*:4._predict) label(Walloon Region)) ///
					(model_3a_me_DE , keep(*:4._predict) label(Germany))   		///
					(model_3a_me_IE , keep(*:4._predict) label(Ireland)) 	  	///
					(model_3a_me_NO1 , keep(*:3._predict) label(Norway)) 	  	///
					(model_3a_me_PT , keep(*:3._predict) label(Portugal)) 	  	///
					, swapnames  xline(0) 
		graph save "dump\me_without_sd.gph", replace
		graph use "dump\me_without_sd.gph"
		graph export "output\figures\Fig_A4.1.pdf", replace			
		
		* Without controlling for domicile & education
		*   4) Without a class base (Germany, Ireland, Norway, Portugal, Flanders, Walloon)
		set scheme plottigblind
		coefplot    (model_3b_me_FL , keep(*:4._predict) label(Flemish Region)) ///
					(model_3b_me_DE , keep(*:4._predict) label(Germany))   		///
					(model_3b_me_IE , keep(*:4._predict) label(Ireland)) 	  	///
					(model_3b_me_NO1 , keep(*:3._predict) label(Norway)) 	  	///
					, swapnames  xline(0) 
		graph save "dump\me_without_sd_b.gph", replace
		graph use "dump\me_without_sd_b.gph"
		graph export "output\figures\Fig_A4.2.pdf", replace	
		
***********************************************************************************************************
**** 					Table A3: The class base of party families in the 13 countries					***
***********************************************************************************************************
		
* see models in lines 133-464										


***********************************************************************************************************
**** 		Figure A5: Comparison between multinomial logit and binary logit (+90% and 95% CI)			***
***********************************************************************************************************

* einfache logit-Modelle		
* Model 4a) nur class
								
	* 2 - CH
	 logit  wahlabsicht_sd 	ib1.class 																	///
																										///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 2																///
							, cl(cyear)  
	est store model_4a_CH
	esttab model_4a_CH using "dump\model_4a_CH.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_CH: margins, dydx(class) post
	esttab model_4a_me_CH using "dump\model_4a_me_CH.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace							
								
	
	
	
	* 3 - DE
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 3																///
							, cl(cyear)  
	est store model_4a_DE
	esttab model_4a_DE using "dump\model_4a_DE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_DE: margins, dydx(class) post
	esttab model_4a_me_DE using "dump\model_4a_me_DE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
								
	* 4 - DK
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 4																///
							, cl(cyear)  
	est store model_4a_DK
	esttab model_4a_DK using "dump\model_4a_DK.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_DK: margins, dydx(class) post
	esttab model_4a_me_DK using "dump\model_4a_me_DK.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 5 - ES
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 5																///
							, cl(cyear)
	est store model_4a_ES
	esttab model_4a_ES using "dump\model_4a_ES.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_ES: margins, dydx(class) post
	esttab model_4a_me_ES using "dump\model_4a_me_ES.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 6 - FI
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 6																///
							, cl(cyear)  
	est store model_4a_FI
	esttab model_4a_FI using "dump\model_4a_FI.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_FI: margins, dydx(class) post
	esttab model_4a_me_FI using "dump\model_4a_me_FI.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 7 - FR
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 7																///
							, cl(cyear)  
	est store model_4a_FR
	esttab model_4a_FR using "dump\model_4a_FR.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_FR: margins, dydx(class) post
	esttab model_4a_me_FR using "dump\model_4a_me_FR.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 8 - GB
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 8																///
							, cl(cyear)  
	est store model_4a_GB
	esttab model_4a_GB using "dump\model_4a_GB.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_GB: margins, dydx(class) post
	esttab model_4a_me_GB using "dump\model_4a_me_GB.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
								
	* 9 - IE
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 9																///
							, cl(cyear)  
	est store model_4a_IE
	esttab model_4a_IE using "dump\model_4a_IE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_IE: margins, dydx(class) post
	esttab model_4a_me_IE using "dump\model_4a_me_IE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace									
	
	* 10 - NL
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 10																///
							, cl(cyear)  
	est store model_4a_NL
	esttab model_4a_NL using "dump\model_4a_NL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_NL: margins, dydx(class) post
	esttab model_4a_me_NL using "dump\model_4a_me_NL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
	
	
		* 11 - NO 
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 11																///
							, cl(cyear)  
	est store model_4a_NO
	esttab model_4a_NO using "dump\model_4a_NO.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_NO: margins, dydx(class) post
	esttab model_4a_me_NO using "dump\model_4a_me_NO.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	
											

	
	
	* 12 - PT 
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 12 																///
							, cl(cyear)  
	est store model_4a_PT
	esttab model_4a_PT using "dump\model_4a_PT.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_PT: margins, dydx(class) post
	esttab model_4a_me_PT using "dump\model_4a_me_PT.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
	* 13 - SE
	 logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if country == 13																///
							, cl(cyear)  
	est store model_4a_SE
	esttab model_4a_SE using "dump\model_4a_SE.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_SE: margins, dydx(class) post
	esttab model_4a_me_SE using "dump\model_4a_me_SE.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace		
	
	* Flandres
	logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if flemish_new == 1															///
							, cl(cyear)  
	est store model_4a_FL
	esttab model_4a_FL using "dump\model_4a_FL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_FL: margins, dydx(class) post
	esttab model_4a_me_FL using "dump\model_4a_me_FL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace	

	
	* Walloon
	logit  wahlabsicht_sd 	ib1.class 																	///
																		///
							ib1.essround																///
							i.gndr c.agea ib0.wohnort													///
							i.education								 									///
							if walloon_new == 1															///
							, cl(cyear)  
	est store model_4a_WAL
	esttab model_4a_WAL using "dump\model_4a_WAL.rtf", 	stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) 	///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace															
						
	eststo model_4a_me_WAL: margins, dydx(class) post
	esttab model_4a_me_WAL using "dump\model_4a_me_WAL.rtf", stats(r2_p chi2 N, labels("Pseudo R-squared" "Model chi-square" "N")) ///
											cells(b(star fmt(%9.2f)) t(par)) 										///
											varwidth(30) modelwidth(10) 											///
											label unstack replace

	set scheme plottigblind

	* 2 - CH SD = 3: predict
	coefplot    (model_3a_me_CH ,  swapnames keep(*:3._predict) label(mlogit))   		///
				(model_4a_me_CH ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(CH) levels (95 90) 
	graph save "dump\vergleich_CH.gph", replace
	
	* 3 - DE SD = 4: predict
	coefplot    (model_3a_me_DE ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_DE ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(DE) levels (95 90) 
	graph save "dump\vergleich_DE.gph", replace
	
	* 4 - DK SD = 3: predict
	coefplot    (model_3a_me_DK ,  swapnames keep(*:3._predict) label(mlogit))   		///
				(model_4a_me_DK ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(DK) levels (95 90) 
	graph save "dump\vergleich_DK.gph", replace
	
	* 5 - ES SD = 3: predict
	coefplot    (model_3a_me_ES ,  swapnames keep(*:3._predict) label(mlogit))   		///
				(model_4a_me_ES ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(ES) levels (95 90) 
	graph save "dump\vergleich_ES.gph", replace
				
	* 6 - FI SD = 4: predict
	coefplot    (model_3a_me_FI ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_FI ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(FI) levels (95 90) 
	graph save "dump\vergleich_FI.gph", replace

	* 7 - FR SD = 4: predict
	coefplot    (model_3a_me_FR ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_FR ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(FR) levels (95 90) 
	graph save "dump\vergleich_FR.gph", replace

	* 8 - GB SD = 3: predict
	coefplot    (model_3a_me_GB ,  swapnames keep(*:3._predict) label(mlogit))   		///
				(model_4a_me_GB ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(GB) levels (95 90) 
	graph save "dump\vergleich_GB.gph", replace
	
	* 9 - IE SD = 4: predict
	coefplot    (model_3a_me_IE ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_IE ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(IE) levels (95 90) 
	graph save "dump\vergleich_IE.gph", replace
	
	* 10 - NL SD = 4: predict
	coefplot    (model_3a_me_NL ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_NL ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(NL) levels (95 90) 
	graph save "dump\vergleich_NL.gph", replace
	
	* 11 - NO SD = 3: predict
	coefplot    (model_3a_me_NO1 ,  swapnames keep(*:3._predict) label(mlogit))   		///
				(model_4a_me_NO ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(NO) levels (95 90) 
	graph save "dump\vergleich_NO.gph", replace
	
	* 12 - PT SD = 3: predict
	coefplot    (model_3a_me_PT ,  swapnames keep(*:3._predict) label(mlogit))   		///
				(model_4a_me_PT ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(PT) levels (95 90) 
	graph save "dump\vergleich_PT.gph", replace
	
	* 13 - SE SD = 4: predict
	coefplot    (model_3a_me_SE ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_SE ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(SE) levels (95 90) 
	graph save "dump\vergleich_SE.gph", replace
	
	* 14 - FL SD = 4: predict
	coefplot    (model_3a_me_FL ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_FL ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(FL) levels (95 90) 
	graph save "dump\vergleich_FL.gph", replace
	
	* 15 - WAL SD = 4: predict
	coefplot    (model_3a_me_WAL ,  swapnames keep(*:4._predict) label(mlogit))   		///
				(model_4a_me_WAL ,  label(logit))  										///
				,  xline(0) legend(pos(6) rows(1)) title(WL) levels (95 90) 
	graph save "dump\vergleich_WL.gph", replace
	
	grc1leg 		"dump\vergleich_CH.gph" ///
					"dump\vergleich_DE.gph" ///
					"dump\vergleich_DK.gph" ///
					"dump\vergleich_ES.gph" ///
					"dump\vergleich_FI.gph" ///
					"dump\vergleich_FL.gph" ///
					"dump\vergleich_FR.gph" ///
					"dump\vergleich_GB.gph" ///
					"dump\vergleich_IE.gph" ///
					"dump\vergleich_NL.gph" ///
					"dump\vergleich_NO.gph" ///
					"dump\vergleich_PT.gph" ///
					"dump\vergleich_SE.gph" ///
					"dump\vergleich_WL.gph" ,   rows(7) xcommon scale(.8) name(Fig_A5, replace)
	
	
	graph display Fig_A5, ysize(8) xsize(6)
	
	graph save "dump\Fig_A5.gph", replace
	graph use "dump\Fig_A5.gph"
	graph export "output\figures\Fig_A5.pdf", replace


***********************************************************************************************************
**** 		Figure A6: Effects of class on voting for social democrats by ESS round (+95% CI)			***
****								countries with no clear SD class base								***
***********************************************************************************************************

	grc1leg		"dump\me_logit_FL_2.gph" ///
				"dump\me_logit_WL_2.gph" ///
				"dump\me_logit_DE_2.gph" ///
				"dump\me_logit_IE_2.gph" ///
				"dump\me_logit_NO_2.gph" ///
				"dump\me_logit_PT_2.gph" ///
				, rows(3) ycommon xcommon scale(.8) ysize(8)
	graph save "dump\Fig_A6.gph", replace
	graph use "dump\Fig_A6.gph"
	graph export "output\figures\Fig_A6.pdf", replace 

*************************************************************************************************************
*************************************************************************************************************
**********************************************     END 	  ***************************************************
*************************************************************************************************************
*************************************************************************************************************

timer off 1
timer list 1












